﻿// <copyright file="BooleanExtensions.cs" company="DotNetLib">
//
// .netlib: http://www.codeplex.com/DotNetLib
//
// This code is released under the New BSD License.
// A copy of this license is available at:
// http://www.codeplex.com/DotNetLib/license
//
// </copyright>

namespace DotNetLib
{
  /// <summary>
  /// Extension methods for a <see cref="System.Boolean"/>.
  /// </summary>
  public static class BooleanExtensions
  {
    /// <summary>
    /// Converts the boolean into a string representation using the <see cref="BooleanFormatProvider"/>.
    /// </summary>
    /// <param name="value">The <see cref="System.Boolean"/> to convert.</param>
    /// <param name="format">The format string to use during conversion.</param>
    /// <returns>A string representation of the boolean.</returns>
    public static string ToString(this bool value, string format)
    {
      return string.Format(new BooleanFormatProvider(), "{0:" + format + "}", value);
    }
  }
}
